﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SAS.Toolkit;

public partial class activityifo:basePage
{
    /// <summary>
    /// 团队活动列表
    /// </summary>
    protected TeamActInfos[] teamActs = null;
    /// <summary>
    /// 活动id（url参数）
    /// </summary>
    protected int tid = 0;
    /// <summary>
    /// 活动实体
    /// </summary>
    protected TeamActInfos teamInfo = new TeamActInfos();
    /// <summary>
    /// 活动图组
    /// </summary>
    protected string[] imgList = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        tid = Convert.ToInt32(Request.QueryString["tid"]);
        if (GetCacheActivity(tid) != null)
        {
            teamInfo = GetCacheActivity(tid);
        }
        if (teamInfo != null)
        {
            imgList = teamInfo.Piccollect.Split(',');
        }
    }
    /// <summary>
    /// 根据活动id获取缓存里的活动实体
    /// </summary>
    /// <param name="userName"></param>
    /// <returns></returns>
    protected TeamActInfos GetCacheActivity(int tid)
    { 
        teamActs = GetCacheTeamActs(1);
        List<TeamActInfos> mlist = new List<TeamActInfos>();
        mlist.AddRange(teamActs);
        //委托
        Predicate<TeamActInfos> mpush = new Predicate<TeamActInfos>(delegate(TeamActInfos activ) { return activ.Actid==tid; });
        teamInfo = mlist.Find(mpush);
        return teamInfo;
    }
}
